// xfImgBit8.cpp: implementation of the xfImgBit8 class.
//
//////////////////////////////////////////////////////////////////////

#include "stdafx.h"
#include "xfImgBit8.h"


//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

#define GetGray(r,g,b) ((int)r+(int)g+(int)b)/3 


xfImgBit* CreateImgBit8()
{
	xfImgBit8* pPlug = new xfImgBit8;
	
	if(NULL != pPlug)
	{
		return (xfImgBit*)pPlug;
	}
	
	return (NULL);
}


xfImgBit8::xfImgBit8()
{

}

xfImgBit8::~xfImgBit8()
{
    UnInitialize();	
}

void xfImgBit8::UnInitialize()
{
	
}  

int xfImgBit8::Initialize()
{
	UnInitialize(); 

	return 0;
}


int xfImgBit8::SetImgBit(zkImgBitInfo *pImgInfo)
{
	m_pImgInfo = pImgInfo;

	return 0;
}



int xfImgBit8::SetImgBuffer(zkImgBitInfo *pImgInfo,BOOL bShareMem)
{
	int nRet = DD_ERR_FAILURE;

	UnInitialize();

	BITMAPINFOHEADER *pBitInfo = (BITMAPINFOHEADER*)pImgInfo->pImageHeader;
	if( NULL == pBitInfo )
	{
		return DD_ERR_FAILURE;
	}

	//int nHeaderSize = sizeof(BITMAPINFOHEADER);
	//nHeaderSize += sizeof(RGBQUAD) * GetColorTableEntries( pBitInfo->biBitCount );
	int nHeaderSize = sizeof(BITMAPINFOHEADER) + pBitInfo->biClrUsed * sizeof(RGBQUAD);

	int nDataLen = pBitInfo->biHeight * pBitInfo->biWidth * (pBitInfo->biBitCount>>3);


	

	return DD_ERR_SUCCESS;
}



int xfImgBit8::Restore()
{
	return 0;
}

int xfImgBit8::Operate(void *pMethod)
{
	int nRet = DD_ERR_FAILURE;
	
	
	return nRet;
}

int xfImgBit8::GetImageSize(int &nWidth,int &nHeight)
{
	
	return DD_ERR_SUCCESS;
}



int xfImgBit8::GetHistogramInfo(zkImgHistogram **ppHistogram)
{


	return DD_ERR_SUCCESS;
}


int xfImgBit8::LoadFile(char *pFileName)
{

	return DD_ERR_SUCCESS;
}
int xfImgBit8::SaveFile(char *pFileName)
{

	return DD_ERR_SUCCESS;
}

int xfImgBit8::GetOrgImgBuffer(zkImgBitInfo **ppImgInfo)
{
	return DD_ERR_SUCCESS;
}
int xfImgBit8::GetImgBuffer(zkImgBitInfo **ppImgInfo)
{
    return DD_ERR_SUCCESS;
}


